****** Density histograms, Figure 1 ******

*** III Kad ***

sum PARTY_loyalM if PARL_GROUP!=0 & KADENCJA==3

graph set window fontface "Times New Roman"
histogram PARTY_loyalM if PARL_GROUP!=0 & KADENCJA==3, density ytitle("Density", margin(bargraph) alignment(middle) size(large)) yscale(range(0 30)) ylabel(#5) xtitle("Party loyalty scores", margin(bargraph) size(large)) xscale(range(0 1)) xlabel(#5) title("III Kadencja (1997-2001)", size(vlarge) margin(medium)) note("Mean = 0.924  SD = 0.076  N = 1458", justification(left) alignment(baseline) size(medlarge) ring(0) position(12)) scheme(s1mono) aspectratio(1) xsize(5) ysize(5) 
graph di, margins(zero)

*** IV Kad ***

sum PARTY_loyalM if PARL_GROUP!=0 & KADENCJA==4

graph set window fontface "Times New Roman"
histogram PARTY_loyalM if PARL_GROUP!=0 & KADENCJA==4, density ytitle("") yscale(range(0 30)) ylabel(#5) xtitle("Party loyalty scores", margin(bargraph) size(large)) xscale(range(0 1)) xlabel(#5) title("IV Kadencja (2001-2005)", size(vlarge) margin(medium)) note("Mean = 0.949  SD = 0.087  N = 1922", justification(left) alignment(baseline) size(medlarge) ring(0) position(12)) scheme(s1mono) aspectratio(1) xsize(5) ysize(5) 
graph di, margins(zero)

*** V Kad ***

sum PARTY_loyalM if PARL_GROUP!=0 & KADENCJA==5

graph set window fontface "Times New Roman"
histogram PARTY_loyalM if PARL_GROUP!=0 & KADENCJA==5, density ytitle("") yscale(range(0 30)) ylabel(#5) xtitle("Party loyalty scores", margin(bargraph) size(large)) xscale(range(0 1)) xlabel(#5) title("V Kadencja (2005-2007)", size(vlarge) margin(medium)) note("Mean = 0.976  SD = 0.054  N = 1522", justification(left) alignment(baseline) size(medlarge) ring(0) position(12)) scheme(s1mono) aspectratio(1) xsize(5) ysize(5) 
graph di, margins(zero)

****** Independent variable descriptive statistics, Table 2 ******

tabstat GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM ALMA_loyalM POLIT_loyalM COM1_loyalM COM2_loyalM if PARL_GROUP!=0 & KADENCJA==3, columns(s) s(n me sd)
tabstat GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM ALMA_loyalM POLIT_loyalM COM1_loyalM COM2_loyalM if PARL_GROUP!=0 & KADENCJA==4, columns(s) s(n me sd)
tabstat GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM ALMA_loyalM POLIT_loyalM COM1_loyalM COM2_loyalM if PARL_GROUP!=0 & KADENCJA==5, columns(s) s(n me sd)

****** Logistic GLM, Tables 3, 4, and 5 ******

*** III Kad ***

* (1) Basic Model

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY if PARL_GROUP!=0 & KADENCJA==3, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

* (2) Model with Biographies/Alma_Mater

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM ALMA_loyalM POLIT_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY if PARL_GROUP!=0 & KADENCJA==3, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

* (3) Model with Committees

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM COM1_loyalM COM2_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY COM_DUMMY* if PARL_GROUP!=0 & KADENCJA==3, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

* (4) Full Model

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM ALMA_loyalM POLIT_loyalM COM1_loyalM COM2_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY COM_DUMMY* if PARL_GROUP!=0 & KADENCJA==3, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

*** IV Kad ***

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY if PARL_GROUP!=0 & KADENCJA==4, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

* (2) Model with Biographies/Alma_Mater

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM ALMA_loyalM POLIT_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY if PARL_GROUP!=0 & KADENCJA==4, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

* (3) Model with Committees

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM COM1_loyalM COM2_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY COM_DUMMY* if PARL_GROUP!=0 & KADENCJA==4, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

* (4) Full Model

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM ALMA_loyalM POLIT_loyalM COM1_loyalM COM2_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY COM_DUMMY* if PARL_GROUP!=0 & KADENCJA==4, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

*** V Kad ***

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY if PARL_GROUP!=0 & KADENCJA==5, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

* (2) Model with Biographies/Alma_Mater

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM ALMA_loyalM POLIT_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY if PARL_GROUP!=0 & KADENCJA==5, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

* (3) Model with Committees

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM COM1_loyalM COM2_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY COM_DUMMY* if PARL_GROUP!=0 & KADENCJA==5, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

* (4) Full Model

glm PARTY_loyalM GEN_loyalM EDUC_loyalM CLASS_loyalM REGION_loyalM ALMA_loyalM POLIT_loyalM COM1_loyalM COM2_loyalM LN_VOTES POSN PAST_MP AGE AGE2 GENDER i.PARTY COM_DUMMY* if PARL_GROUP!=0 & KADENCJA==5, link(logit) family(binomial) vce(cl ID)
test
estat ic
glm, eform

****** Appendices ******

*** Table A2 ***

sort ID KADENCJA
by ID KADENCJA: gen GENCOUNT = 1 if _n==1 & GENDER==1
by ID KADENCJA: replace GENCOUNT = 0 if _n==1 & GENDER==0

bysort KADENCJA: tab GENCOUNT

sort ID
by ID KADENCJA: gen EDUCCOUNT = 0 if _n==1 & EDUC==0
by ID KADENCJA: replace EDUCCOUNT = 1 if _n==1 & EDUC==1
by ID KADENCJA: replace EDUCCOUNT = 2 if _n==1 & EDUC==2
by ID KADENCJA: replace EDUCCOUNT = 3 if _n==1 & EDUC==3
by ID KADENCJA: replace EDUCCOUNT = 4 if _n==1 & EDUC==4
by ID KADENCJA: replace EDUCCOUNT = 5 if _n==1 & EDUC==5
by ID KADENCJA: replace EDUCCOUNT = 6 if _n==1 & EDUC==6

bysort KADENCJA: tab EDUCCOUNT

sort ID KADENCJA
by ID KADENCJA: gen CLASSCOUNT = 1 if _n==1 & CLASS==1
by ID KADENCJA: replace CLASSCOUNT = 2 if _n==1 & CLASS==2
by ID KADENCJA: replace CLASSCOUNT = 3 if _n==1 & CLASS==3
by ID KADENCJA: replace CLASSCOUNT = 4 if _n==1 & CLASS==4
by ID KADENCJA: replace CLASSCOUNT = 5 if _n==1 & CLASS==5
by ID KADENCJA: replace CLASSCOUNT = 6 if _n==1 & CLASS==6
by ID KADENCJA: replace CLASSCOUNT = 7 if _n==1 & CLASS==7
by ID KADENCJA: replace CLASSCOUNT = 8 if _n==1 & CLASS==8

bysort KADENCJA: tab CLASSCOUNT

sort ID KADENCJA
by ID KADENCJA: gen POLITCOUNT = 1 if _n==1 & POLIT==1
by ID KADENCJA: replace POLITCOUNT = 2 if _n==1 & POLIT==2
by ID KADENCJA: replace POLITCOUNT = 3 if _n==1 & POLIT==3
by ID KADENCJA: replace POLITCOUNT = 4 if _n==1 & POLIT==4
by ID KADENCJA: replace POLITCOUNT = 5 if _n==1 & POLIT==5
by ID KADENCJA: replace POLITCOUNT = 6 if _n==1 & POLIT==6
by ID KADENCJA: replace POLITCOUNT = 7 if _n==1 & POLIT==7
by ID KADENCJA: replace POLITCOUNT = 8 if _n==1 & POLIT==8
by ID KADENCJA: replace POLITCOUNT = 9 if _n==1 & POLIT==9
by ID KADENCJA: replace POLITCOUNT = 10 if _n==1 & POLIT==10
by ID KADENCJA: replace POLITCOUNT = 11 if _n==1 & POLIT==11
by ID KADENCJA: replace POLITCOUNT = 12 if _n==1 & POLIT==12
by ID KADENCJA: replace POLITCOUNT = 13 if _n==1 & POLIT==13
by ID KADENCJA: replace POLITCOUNT = 14 if _n==1 & POLIT==14
by ID KADENCJA: replace POLITCOUNT = 15 if _n==1 & POLIT==15
by ID KADENCJA: replace POLITCOUNT = 16 if _n==1 & POLIT==16
by ID KADENCJA: replace POLITCOUNT = 17 if _n==1 & POLIT==17
by ID KADENCJA: replace POLITCOUNT = 18 if _n==1 & POLIT==18

bysort KADENCJA: tab POLITCOUNT
